/*
 * @Author: 梓岄 3049738225@qq.com
 * @Date: 2025-11-22 18:23:29
 * @LastEditors: 梓岄 3049738225@qq.com
 * @LastEditTime: 2025-11-22 20:04:04
 * @FilePath: /sharememry/Client.cc
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
#include"Shm.hpp"

int main()
{
    Shm sharedmam;
    sharedmam.Get();
    sharedmam.Attach();

    sleep(2);

    sharedmam.PrintAttr();

    char* shm_start=(char*)sharedmam.Addr();
    int size=sharedmam.Size();
    int index=0;
    while(true)
    {
        std::cout<<"Please Enter@ ";
        char ch;
        std::cin>>ch;
        // std::cin>>*shm_start;
        // *(shm_start+=index)=ch;
        shm_start[index++]=ch;
        // shm_start+=index;
        // shm_start++;
        index%=size;
        // sleep(1);
    }

    sharedmam.Detach();
    
    return 0;
}